<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>${setting.siteName} - 主页</title>
    <meta name="keywords" content="${setting.siteName}">
    <meta name="description" content="${setting.siteName}">

    <!-- BEGIN HEADER -->
[#include "/admin/include/style.ftl"]
    <!-- END HEADER -->
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>积分设置</h5>
                </div>
                <div class="ibox-content">
                    <form action="updatePoint.jhtml" id="inputForm" method="post" enctype="multipart/form-data"
                          class="form-horizontal">
                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>用户完善资料
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="registorPoint" id="registorPoint" value="${setting.registorPoint}"
                                               class="form-control">
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>抽奖每次消耗积分</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="buyPoint" id="buyPoint" value="${setting.buyPoint}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>新增客户
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="addCustom" value="${setting.addCustom}"
                                               class="form-control">
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>检测新用户</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="addCheck" value="${setting.addCheck}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>分享一次
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="addShare" id="addShare" value="${setting.addShare}"
                                               class="form-control">
                                    </div>
                                </div>

                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>上线时间
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="times"
                                               value="${setting.sysTime?number_to_datetime?string("yyyy-MM-dd")!''}"
                                               class="form-control date">
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>随机增加范围
                                    </label>
                                    <div class="col-sm-9 row">
                                        <div class="col-sm-5">
                                            <input type="text" name="randomStart" id="randomStart" value="${setting.randomStart}"
                                                   class="form-control ">
                                        </div>
                                        <div class="col-sm-1">~</div>
                                        <div class="col-sm-5">
                                            <input type="text" name="randomEnd" id="randomEnd" value="${setting.randomEnd}"
                                                   class="form-control col-sm-6">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"
                                                                                aria-required="true"> * </span>用户基数
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="userBaseCount" id="userBaseCount" value="${setting.userBaseCount}"
                                               class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">是否开启虚拟用户</label>
                                    <div class="col-sm-9">

                                        <div class="checkbox-inline i-checks">
                                            <input type="checkbox" class="i-checks"
                                                   name="enableMachine" [#if setting.enableMachine]checked[/#if]>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-12 col-sm-offset-10">
                                <button type="button" class="btn btn-default" onclick="clearPoint()">清空积分</button>

                                <button class="btn btn-success" type="submit">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- BEGIN Script -->
[#include "/admin/include/script.ftl"]
<!-- END Script -->
<script>
    $(document).ready(function () {
    [@flash_message /]

        $('#file-pretty input[type="file"]').prettyFile();

        $(".date").datepicker({
            language: 'zh-CN',
            format: "yyyy-mm-dd",
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1
        });

        $(".chosen-select").chosen({width: "100%"});

        $("#inputForm").validate({
            rules: {
                registorPoint:{
                    required: true,
                    digits:true
                },
                addShare:{
                    required: true,
                    digits:true
                },
                randomStart:{
                    required: true,
                    digits:true
                },
                randomEnd:{
                    required: true,
                    digits:true
                },
                userBaseCount:{
                    required: true,
                    digits:true
                }
            },
            messages: {}
        });
    });

    function clearPoint() {
        bootbox.confirm(message("admin.dialog.deleteConfirm"), function (result) {
            if (result) {
                $.ajax({
                    url: "${base}/admin/tuser/clearPoint.jhtml",
                    type: "POST",
                    data: {},
                    dataType: "json",
                    cache: false,
                    success: function (message) {
                        window.setTimeout(function () {
                            art.warn("清理成功");
                            window.location.reload();
                        }, 1000);
                    }
                });
            }
        });
    }

</script>
</body>

</html>
